import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;


import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.SQLOutput;
import java.util.Date;
import java.util.Scanner;

public class Main {
    public static void main1(String[] args) throws SQLException {//数据库连接测试
      /* Scanner scanner=new Scanner(System.in);
        int id=scanner.nextInt();*/

        //创建并且初始化一个数据源
        DataSource dataSource=new MysqlDataSource();
         ((MysqlDataSource)dataSource).setUrl("jdbc:mysql://127.0.0.1:3306/java107?characterEncoding=utf8&useSSL=false");
        ((MysqlDataSource)dataSource).setUser("root");
        ((MysqlDataSource)dataSource).setPassword("zcwa");
        //和数据库服务器建立连接
        Connection connection=dataSource.getConnection();
        //构造SQL语句
        String sql="insert into student values(1,'张三')";
        PreparedStatement statement=connection.prepareStatement(sql);
        //执行SQL语句
        int ret=statement.executeUpdate();
        //释放必要资源
        statement.close();
        connection.close();
        System.out.println();
    }

    public static void main(String[] args) {
        String str="abc";
        String str1=new String("abcd");
        System.out.println(str1.equals(str));
        String str2=str1.intern();
        String str3="abcd";
        System.out.println(str1.compareTo(str3));
        System.exit(0);
        System.out.println(System.currentTimeMillis());
        Runtime runtime=Runtime.getRuntime();
        System.out.println(runtime.maxMemory());
        Date date =new Date();
        System.out.println(date.toString());
        Thread thread=new Thread();
        System.out.println(thread.getName());
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }


    }
}